
    /********************************************************/
    /*                                                      */
    /*                                                      */
    /*         Copyright (C), 1993  SEIKO EPSON Corp.       */
    /*         ALL RIGHTS RESERVED                          */
    /*                                                      */
    /*                                                      */
    /*  file name : calloc.c                                */
    /*                                                      */
    /*  Revision history                                    */
    /*      93/12/17    first release       S.Akaiwa        */
    /*      97/02/20    modified            T.Katahira      */
    /*                      change function declaration     */
    /*                          to the ANSI style           */
    /*      00/05/25    modified            M.Kakinuma      */
    /*      04/04/12    modified            M.Takeishi      */
    /*                                                      */
    /********************************************************/

#ifdef      UNIX
#include    "stdio.h"
#include    "stdlib.h"
#include    "smcvals.h"
#include    "errno.h"
#else
#include    <stdio.h>
#include    <stdlib.h>
#include    <smcvals.h>
#include    <errno.h>
#endif


    /********************************************************/
    /*                                                      */
    /*  The calloc function allocates memory for an array   */
    /*  of tdEleSiz element of tdEleSiz bytes. All memory   */
    /*  is cleared by 0.                                    */
    /*  If calloc function can not be allocated memory      */
    /*  block, NULL pointer is returned.                    */
    /*  If 0 is specified by tdEltCnt or tdEltSiz, calloc   */
    /*  function returns NULL.                              */
    /*  If successful, this function returns top address to */
    /*  allocated memory block.                             */
    /*  The memory block is allocated from 4 byte boundary. */
    /*  If you need the information of malloc memory map,   */
    /*  please refer to malloc source file.                 */
    /*                                                      */
    /*      RETURN  NULL    ... Memory allocate error       */
    /*              Others  ... Top address to allocated    */
    /*                          memory block                */  
    /*                                                      */
    /********************************************************/

    /* size_t tdEltCnt;                 number of element count */
    /* size_t tdEltSiz;                      size of an element */

void *
calloc(size_t tdEltCnt, size_t tdEltSiz)
{
	size_t tdSiz = tdEltCnt * tdEltSiz;
	void * ptr = malloc(tdSiz);
	if (NULL == ptr) {
		return NULL;
	}
	memset(ptr, 0, tdSiz);
	return ptr;
}

